package sk.fhi.server.handler;

import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.DispatchException;
import sk.fhi.shared.model.AbstractEntity;
import sk.fhi.shared.rpc.action.SaveAction;
import sk.fhi.shared.rpc.result.SaveResult;

public class SaveHandler extends AbstractActionHandler<SaveAction, SaveResult>{

	@Override
	public SaveResult execute(SaveAction arg0, ExecutionContext arg1)
			throws DispatchException {
		AbstractEntity entity = arg0.getEntity();
		crudService.save(entity);
		return new SaveResult(entity);
	}

	@Override
	public Class<SaveAction> getActionType() {
		return SaveAction.class;
	}

}
